package display;

import java.awt.Color;
import java.awt.Container;
import java.util.Observable;
import java.util.Observer;

import universe.Game;

@SuppressWarnings("serial")
public class GameDisplay extends Container implements Observer{

		private BoardDisplay boardDisplay;
		private BlockDisplay blockDisplay;
		private Game		 game;

		public GameDisplay(Game pGame) {
			super();
			this.setGame(pGame);
			
			this.boardDisplay = new BoardDisplay(pGame.getBoard());
			this.blockDisplay = new BlockDisplay(pGame);
			
			this.setBackground(Color.BLACK);
			this.add(this.blockDisplay,0);
			this.add(this.boardDisplay,1);
		}

		public void setGame(Game game) {
			this.game = game;
			game.addObserver(this);
		}

		public Game getGame() {
			return game;
		}

		@Override
		public void update(Observable o, Object arg) {
			this.repaint();
		}
		
}
